package com.EAIPClub.CodeShell.controller;

import com.EAIPClub.CodeShell.service.CodeShellService;
import com.api.POJO.CodeLab.CodeShell.CodeShellDebugInfo;
import com.api.POJO.CodeLab.CodeShell.CodeShellReturnMsg;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

/**
 * @Description :
 * @Author :
 * @Date : 2021/12/7
 */
@RestController
public class CodeShellController {

    private CodeShellService service;

    @Autowired
    public void setService(CodeShellService service) {
        this.service = service;
    }

    @GetMapping("/codeshell/open/{token}")
    public CodeShellReturnMsg openCodeShell(@PathVariable String token){
        return service.openCodeShell(token);
    }

    @GetMapping("/codeshell/vl/{token}")
    public CodeShellReturnMsg codeShellValidating(@PathVariable String token){
        return service.codeShellValidating(token);
    }

    @PostMapping("/codeshell/upload/{token}")
    public CodeShellReturnMsg codeShellUpload(@PathVariable String token,@RequestParam(value = "file") MultipartFile file){
        return service.upload(token,file);
    }

}
